package com.cbgolf.oa.activity.bill;

import android.os.Bundle;
import android.support.annotation.Nullable;

import com.cbgolf.oa.R;
import com.cbgolf.oa.base.BaseActivity;
import com.cbgolf.oa.model.OrderModel;
import com.cbgolf.oa.presenter.IOrderPresenter;
import com.cbgolf.oa.views.OrderListView;

/**
 * 账单列表
 * 主要对应统计账单查询
 *
 * @author lq
 * @date 2017/11/4
 */

public class BillListActivity extends BaseActivity implements IOrderPresenter {

  private OrderListView view;
  private OrderModel model;
  private final int LOAD_INIT = 0;
  private final int REFRESH = 1;
  private final int LOADMORE = 2;
  private final int CHOOSE_DATE = 3;
  private final int FILTER_USER = 4;

  @Override
  protected void onCreate(@Nullable Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.a_order_list);
  }

  @Override
  protected void findViews() {
    view = new OrderListView(this, this);
    model = new OrderModel(this, this);
  }

  @Override
  public String getActivityTitle() {
    return "帐单查询";
  }

  @Override
  public void back() {
    finish();
  }

  @Override
  public void showProgress() {
    view.showProgress();
  }

  @Override
  public void stopProgress() {
    view.stopProgress();
  }

  @Override
  public void getDataFail(String msg) {
    view.getDataFail(msg);
  }

  @Override
  public void getDataSuccess(Object obj) {
    view.showData(obj);
  }


  @Override
  public void loadMore() {
    model.getData(LOADMORE);
  }

  @Override
  public void showOrderDetails(String id) {
    mStartActivity(AccountDetails.class, "id", id);
  }

  @Override
  public void getData(String date) {
    model.setTeeTimeDate(date);
    model.getData(CHOOSE_DATE);
  }

  @Override
  public void reLoad() {
    model.getData(LOAD_INIT);
  }

  @Override
  public void getDataByUserId(String id) {
    model.setCustomerId(id);
    model.getData(FILTER_USER);
  }


  @Override
  public void refershFail(String msg, int code) {
    view.getDataFail(msg, code);
  }

  @Override
  public void refershSuccess(Object obj) {
    view.showData(obj);
  }

  @Override
  public void loadMoreFail(String msg, int code) {

  }

  @Override
  public void loadMoreSuccess(Object obj) {
    view.loadMoreSuccess(obj);
  }

  @Override
  public void refresh() {
    model.getData(REFRESH);
  }

  @Override
  public void getUserListFail(String msg) {
    view.getUserListFail(msg);
  }

  @Override
  public void getUserlistSuccess(Object obj) {
    view.getUserlistSuccess(obj);
  }

  @Override
  public void getDataByDateFail(String msg) {
    view.getDataByDateFail(msg);
  }

  @Override
  public void getDataByDateSuccess(Object obj) {
    view.getDataByDateSuccess(obj);
  }

  @Override
  public void getDataByUserFail(String msg) {
    view.getDataByUserFail(msg);
  }

  @Override
  public void getDataByUserSuccess(Object obj) {
    view.getDataByUserSuccess(obj);
  }

  @Override
  public void getDataFail(String msg, int code) {
    view.getDataFail(msg);
  }
}
